<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="keywords" content="html5,jquery,ui,widgets,ajax,ria,web framekwork,web development,easy,easyui,datagrid,treegrid,tree">
		<meta name="description" content="jQuery EasyUI is a complete framework for HTML5 web page. It provides easy to use components for building modern, interactive, javascript applications that work on pc and mobile devices.">
		<title>switchbutton - Documentation - jQuery EasyUI</title>
        <link rel="stylesheet" href="/css/kube.css" type="text/css" />
        <link rel="stylesheet" type="text/css" href="../css/main.css">
		<link rel="stylesheet" type="text/css" href="../../prettify/prettify.css">
		<script type="text/javascript" src="../../prettify/prettify.js"></script>
		<script type="text/javascript" src="/easyui/jquery.min.js"></script>
		<script type="text/javascript">
			$(function(){
								$('textarea[name="code-switchbutton"]').each(function(){
					var data = $(this).val();
					data = data.replace(/(\r\n|\r|\n)/g, '\n');
					if (data.indexOf('\t') == 0){
						data = data.replace(/^\t/, '');
						data = data.replace(/\n\t/g, '\n');
					}
					data = data.replace(/\t/g, '    ');
					var pre = $('<pre name="code" class="prettyprint linenums"></pre>').insertAfter(this);
					pre.text(data);
					$(this).remove();
				});
				prettyPrint();
			});
		</script>
	</head>
	<body>
		<div id="header" class="group wrap header">
			<div class="content">
	<div class="navigation-toggle" data-tools="navigation-toggle" data-target="#navbar-1">
		<span>EasyUI</span>
	</div>
	<div id="elogo" class="navbar navbar-left">
		<ul>
			<li>
				<a href="/index.php"><img src="/images/logo2.png" alt="jQuery EasyUI"/></a>
			</li>
		</ul>
	</div>
	<div id="navbar-1" class="navbar navbar-right">
		<ul>
			<li><a href="/index.php">Home</a></li>
			<li><a href="/demo/main/index.php">Demo</a></li>
			<li><a href="/tutorial/index.php">Tutorial</a></li>
			<li><a href="/documentation/index.php">Documentation</a></li>
			<li><a href="/download/index.php">Download</a></li>
			<li><a href="/extension/index.php">Extension</a></li>
			<li><a href="/contact.php">Contact</a></li>
			<li><a href="/forum/index.php">Forum</a></li>
		</ul>
	</div>
	<div style="clear:both"></div>
</div>
<script type="text/javascript">
	function setNav(){
		var demosubmenu = $('#demo-submenu');
		if (demosubmenu.length){
			if ($(window).width() < 450){
				demosubmenu.find('a:last').hide();
			} else {
				demosubmenu.find('a:last').show();
			}
		}
		if ($(window).width() < 767){
			$('.navigation-toggle').each(function(){
				$(this).show();
				var target = $(this).attr('data-target');
				$(target).hide();
				setDemoNav();
			});
		} else {
			$('.navigation-toggle').each(function(){
				$(this).hide();
				var target = $(this).attr('data-target');
				$(target).show();
			});
		}
	}
	function setDemoNav(){
		$('.navigation-toggle').each(function(){
			var target = $(this).attr('data-target');
			if (target == '#navbar-demo'){
				if ($(target).is(':visible')){
					$(this).css('margin-bottom', 0);
				} else {
					$(this).css('margin-bottom', '2.3em');
				}
			}
		});
	}
	$(function(){
		setNav();
		$(window).bind('resize', function(){
			setNav();
		});
		$('.navigation-toggle').bind('click', function(){
			var target = $(this).attr('data-target');
			$(target).toggle();
			setDemoNav();
		});
	})
</script>		</div>
		<div id="mainwrap">
			<div id="content" class="content">
			
<div style="padding:10px"><h3>SwitchButton</h3><p>Override defaults with $.fn.switchbutton.defaults.</p><p>The switch button can be used in a &lt;form&gt;. It has two states: 'on' and 'off'.The user can click or tap to toggle the switch.Labels of the states are customizable.</p><img src="images/switchbutton.png"/><h4>Usage</h4><p>Create switchbutton from markup.</p><textarea name="code-switchbutton" class="html">	<input class="easyui-switchbutton" checked>	<input class="easyui-switchbutton" data-options="onText:'Yes',offText:'No'"></textarea><p>Create switchbutton using javascript.</p><textarea name="code-switchbutton" class="html">	<input id="sb" style="width:200px;height:30px">	<script type="text/javascript">		$(function(){			$('#sb').switchbutton({				checked: true,				onChange: function(checked){					console.log(checked);				}			})		})	</script></textarea><h4>Properties</h4><table class="doc-table"><tr><th><strong>Name</strong></th><th><strong>Type</strong></th><th><strong>Description</strong></th><th><strong>Default</strong></th></tr><tr><td>width</td><td>number</td><td>The width of switchbutton.</td><td>60</td></tr><tr><td>height</td><td>number</td><td>The height of switchbutton.</td><td>26</td></tr><tr><td>handleWidth</td><td>number</td><td>The width of the center handle of switchbutton.</td><td>auto</td></tr><tr><td>checked</td><td>boolean</td><td>Defines if the button is checked.</td><td>false</td></tr><tr><td>disabled</td><td>boolean</td><td>Defines if to disable the button.</td><td>false</td></tr><tr><td>readonly</td><td>boolean</td><td>Defines if the button is read-only.</td><td>false</td></tr><tr><td>reversed</td><td>boolean</td><td>Set to true the onText value and offText value will switch their positions.</td><td>false</td></tr><tr><td>onText</td><td>string</td><td>The text value of the left side.</td><td>ON</td></tr><tr><td>offText</td><td>string</td><td>The text value of the right side.</td><td>OFF</td></tr><tr><td>handleText</td><td>string</td><td>The text value of the center handle.</td><td>''</td></tr><tr><td>value</td><td>string</td><td>The default value bound to the button.</td><td>on</td></tr></table><h4>Events</h4><table class="doc-table"><tr><th><strong>Name</strong></th><th><strong>Parameters</strong></th><th><strong>Description</strong></th></tr><tr><td>onChange</td><td>checked</td><td>Fires when the checked value is changed.</td></tr></table><h4>Methods</h4><table class="doc-table"><tr><th><strong>Name</strong></th><th><strong>Parameter</strong></th><th><strong>Description</strong></th></tr><tr><td>options</td><td>none</td><td>Return the options object.</td></tr><tr><td>resize</td><td>param</td><td>Resize the switchbutton.</td></tr><tr><td>disable</td><td>none</td><td>Disable the switchbutton. Code example:<pre>$('#sb').switchbutton('disable');</pre></td></tr><tr><td>enable</td><td>none</td><td>Enable the switchbutton. Code example:<pre>$('#sb').switchbutton('enable');</pre></td></tr><tr><td>readonly</td><td>mode</td><td>Enable/Disable readonly mode.</td></tr><tr><td>check</td><td>none</td><td>Check the switchbutton.</td></tr><tr><td>uncheck</td><td>none</td><td>Uncheck the switchbutton.</td></tr><tr><td>clear</td><td>none</td><td>Clear the switchbutton's 'checked' value.</td></tr><tr><td>reset</td><td>none</td><td>Reset the switchbutton's 'checked' value.</td></tr><tr><td>setValue</td><td>value</td><td>Set the switchbutton value.</td></tr></table></div>﻿			</div>
		</div>
		<div id="footer" class="content text-centered">
			<div>Copyright © 2010-2017 www.jeasyui.com</div>
		</div>
	</body>
</html>